package com.iims.flowable.flow.vo.request;

import com.iims.common.core.page.PageDomain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.flowable.common.engine.api.query.Query;
import org.flowable.engine.history.HistoricProcessInstanceQuery;

/**
 * 业务对象关联流程记录查询
 *
 * @author fanpei
 * @date 2021/7/16 21:51
 */
@Data
public class FlowBusinessHistoryQuery extends PageDomain implements IBaseQueryVo<HistoricProcessInstanceQuery> {

    /**
     * 流程业务类型
     */
    @ApiModelProperty(value = "流程业务类型:意向合同(PURPOSE_CONTRACT),合同(CONTRACT),取值括号内英文标识",required = true)
    private String flowBusinessType;

    @ApiModelProperty(value = "流程业务类型Id:目标对象的Id,例如合同对象为contract_id", required = true)
    private Long targetBusinessId;

    /**
     * 业务key
     */
    @ApiModelProperty(hidden = true)
    private String businessKey;

    @Override
    public Query genSearchQuery(HistoricProcessInstanceQuery query) {
        return query.processInstanceBusinessKey(businessKey);
    }

    @Override
    public PageDomain selectPageDomain() {
        return this;
    }
}
